package Locker;

import java.util.HashSet;

public class ReadLock extends Lock {
	HashSet<Thread> readers;
	
	public ReadLock(){
		 this.readers = new HashSet<Thread>();
	}
	
	public void AddReader(Thread t){
		this.readers.add(t);
	}
	
	public void RemoveReader(Thread t){
		this.readers.remove(t);
	}
	
	public boolean isPresent(Thread t){
		return this.readers.contains(t);
	}
	
	public boolean isEmpty(){
		return this.readers.isEmpty();
	}
}